/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ctrl.jeu;

import java.io.Serializable;
import java.util.ArrayList;

/**
 *
 * @author Willy KONGUEM
 */
public class Distribution implements Serializable{
    private ArrayList Card;

    public Distribution() {
        Card=new ArrayList();
    }

    public ArrayList getCard() {
        return Card;
    }
    public boolean isEmpty()
    {
        return Card.size()==0;
    }

    public void setCard(ArrayList Card) {
        this.Card = Card;
    }

    public void ChargeCard()
    {
        String[] tab1= {"2","3","4","5","6","7","8","9","10","J","Q","K","A"};
        Couleur[] tab2= {Couleur.Trefle,Couleur.Carreau,Couleur.Coeur,Couleur.Pique};
        for(int i=0;i<tab1.length;i++)
        {
            for(int j=0;j<tab2.length;j++)
            {
                Card.add(new Carte(tab1[i], tab2[j]));
            }
        }
    }
    public void Affiche()
    {
        System.out.println(Card);
    }
    public Carte Donne()
    {
        int random = (int)(Math.random() * (getCard().size()-0)) + 0;
        Carte c=(Carte) getCard().get(random);
        getCard().remove(random);
        return c;
    }
    public static void main(String[] args )
    {
        Distribution d=new Distribution();
        d.ChargeCard();
        for (int i=0;i<d.getCard().size();i++)
        {
            System.out.println(d.Donne());
        }
    }
}
